package com.k2data.k2app.domain.po;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.k2data.k2app.rest.domain.Region;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.List;

/**
 * 设备分组
 *
 * @author lidong9144@163.com 17-3-16.
 */
@Data
@Table(name = "device_group")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DeviceGroup implements Serializable {

    @Transient
    private static final long serialVersionUID = 2858385452798738207L;

    @JsonIgnore
    @Id
    @GeneratedValue(generator = "JDBC")
    private Long id;
    private String groupNo;
    private String groupName;
    private Integer regionCode;
    private String address;
    private Double longitude;
    private Double latitude;
    @JsonIgnore
    @DateTimeFormat(iso = DateTimeFormat.ISO.DATE_TIME)
    private ZonedDateTime latestContactDate;
    @JsonIgnore
    private String createBy;
    @JsonIgnore
    private String updateBy;
    @JsonIgnore
    private ZonedDateTime createTime;
    @JsonIgnore
    private ZonedDateTime updateTime;

    // 关联表
    @JsonIgnore
    @Transient
    private List<Device> devices;
    @JsonIgnore
    @Transient
    private Region region;
    @JsonIgnore
    @Transient
    private List<EventFault> faults;

}
